import React, { Component } from 'react';
import { connect } from 'react-redux'
import { Modal, Form, Input, Button, Row, Col, } from 'antd';
const FormItem = Form.Item;

class RemarkModal extends Component {
    constructor(props) {
        super(props);
    }

    okHandler = () => {
        const { onOk } = this.props;
        this.props.form.validateFields((err, values) => {
            if (!err) {
                onOk(values);
            }
        });
    };

    render() {
        const { dispatch, item } = this.props;
        const { getFieldDecorator } = this.props.form;
        return (
            <span>
                <Modal
                    maskClosable={this.props.maskClosable}
                    confirmLoading={this.props.confirmLoading}
                    title={'备注编辑'+'\t'+'(资产编号:'+item.assetNo+'\t'+'资产名称：'+item.assetName+')'}
                    visible={this.props.visible}
                    onCancel={this.props.onCancel}
                    key={this.props.newKey}
                    onOk={this.okHandler}
                >

                    <FormItem style={{ marginBottom: '0px' }}>
                        {getFieldDecorator('borrowReturnDetailId', { initialValue: item.id_ + '' })(
                            <Input type="hidden" />
                        )}
                    </FormItem>
                    <FormItem>
                        {
                            getFieldDecorator('returnRemark', {
                                initialValue: item.returnRemark,
                                rules: [{max: 200, message: '备注信息 200 字符以内' },]
                            })(<Input type="textarea" autosize={{ minRows: 4, maxRows: 4 }} />)
                        }
                    </FormItem>
                </Modal>
            </span>
        );
    }
}

export default Form.create()(RemarkModal)